<template>
	<view class="group">
		<view class="groupItem" v-show="actionLabel!==''" @tap="action(status)">{{actionLabel}}</view>
		<view class="groupItem" @tap="needLoginToNav('/pages/action/detail?id='+this.id)">查看详情</view>
	</view>
</template>

<script>
import helper from '../../common/helper';

	export default {
		name:"actionGroup",
		mixins:[helper],
		props:['status','id'],
		data() {
			return {
				actionLabel:'',
			};
		},
		watch:{
			status(newVal,oldVal){
				this.change(this.status);
			}
		},
		methods:{
			change(e){
				switch(e){
					case 0:
					  this.actionLabel='拆修';
					  break;
					case 1:
					  this.actionLabel='';
					  break;
					case 2:
					  this.actionLabel="维修";
					  break;
					case 3:
					  this.actionLabel='试压';
					  break;
					case 4:
					  this.actionLabel='喷漆';
					  break;
					case 5:
					  this.actionLabel='入合格品库';
					  break;
					case 6:
					  this.actionLabel='出库发货';
					  break;
					case 7:
					  this.actionLabel='';
					  break;
					case 8:
					  this.actionLabel='';
					  break;
					default:
					  this.statusText='';
					  break;
				}
			},
			action(status){
				let id=this.id;
				switch(status){
					case 0:
					   uni.navigateTo({
							url:'/pages/action/chai?id='+this.id
					   });
					   break;
					case 2:
						uni.navigateTo({
							url:"/pages/action/xiu?id="+this.id
						});
						break;
					case 3:
						uni.navigateTo({
							url:"/pages/action/shiya?id="+this.id
						});
						break;
					case 4:
						uni.navigateTo({
							url:"/pages/action/penqi?id="+this.id
						});
						break;
					case 5:
						uni.navigateTo({
							url:"/pages/action/ruku?id="+this.id
						})
						break;
					case 6:
						uni.navigateTo({
							url:"/pages/action/fahuo?id="+this.id
						})
						break;
					default:
						uni.navigateTo({
							url:"/pages/action/chai?id="+this.id
						})
						break;
				}
					
			}
		},
		
		mounted() {
			this.change(this.status);
		}
	}
</script>

<style>
.group{
	width:710upx;border-radius:0 0 20upx 20upx;display: flex;padding:20upx 0;
}
.groupItem{
	width:160upx;display: flex;border-radius:10upx;align-items: center;color:#fff;justify-content: center;background:#e61022;margin-left:20upx;font-size:12px;height:50upx;
}
</style>